package stylistcrm.core.services.user;

import stylistcrm.core.services.security.dto.UserDto;
import stylistcrm.core.services.store.Store;
import stylistcrm.core.services.user.profile.UserProfile;

import java.util.List;

/**
 * Created by yanwc on 2016/8/31.
 */
public class User extends UserDto {

    /**
     * 会员编号
     * @return
     */
    public long getMemberId(){
        return this.getId();
    }
    public List<Store> getBelongToStore() {
        return belongToStore;
    }

    public void setBelongToStore(List<Store> belongToStore) {
        this.belongToStore = belongToStore;
    }

    private List<Store> belongToStore;

    private List<UserProfile> userProfileList;

    public  List<UserProfile> getUserProfile() {
        return userProfileList;
    }

    public void setUserProfile( List<UserProfile> userProfile) {
        this.userProfileList = userProfile;
    }

    /**
     * 判断用户是否为制定的类型
     * @param type
     * @return
     */
	public boolean isUserType(EnumUserType type){
        if(this.userProfileList ==null)return false;
        for(UserProfile up :this.userProfileList){
            if(up.isUserType(type)){
                return true;
            }
        }
        return false;
    }
}
